package com.lazycat.backend.controller.address;

import com.alibaba.fastjson.JSONObject;
import com.lazycat.backend.service.address.FetchAddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
public class FetchAddressController {
    @Autowired
    private FetchAddressService fetchAddressService;

    @PostMapping("/address/fetch/")
    public JSONObject fetch(@RequestBody Map<String, String> map) {
        Integer userId = Integer.parseInt(map.get("user_id"));
        return fetchAddressService.fetch(userId);
    }
}
